package com.tchhy.provider.data.healthy.response

import android.os.Parcel
import android.os.Parcelable

/**
 * Created by admin on 2019-12-30
 */
data class AddressListRes(
    var address: String?,
    var addressMark: String?,
    var areaId: Int?,
    var cityId: Int?,
    var consigneeAddressId: String?,
    var consigneeName: String?,
    var familyId: String?,
    /**
     * 0不是默认地址，1是默认地址
     */
    val isDefault: Int?,
    var phone: String?,
    var provinceId: Int?,
    /**
     * 0代表不是被选中的地址, 1代表被选中
     */
    var status: Int?,
    var userId: String?
):Parcelable {
    constructor(parcel: Parcel) : this(
        parcel.readString(),
        parcel.readString(),
        parcel.readValue(Int::class.java.classLoader) as? Int,
        parcel.readValue(Int::class.java.classLoader) as? Int,
        parcel.readString(),
        parcel.readString(),
        parcel.readString(),
        parcel.readValue(Int::class.java.classLoader) as? Int,
        parcel.readString(),
        parcel.readValue(Int::class.java.classLoader) as? Int,
        parcel.readValue(Int::class.java.classLoader) as? Int,
        parcel.readString()
    ) {
    }

    override fun writeToParcel(parcel: Parcel, flags: Int) {
        parcel.writeString(address)
        parcel.writeString(addressMark)
        parcel.writeValue(areaId)
        parcel.writeValue(cityId)
        parcel.writeString(consigneeAddressId)
        parcel.writeString(consigneeName)
        parcel.writeString(familyId)
        parcel.writeValue(isDefault)
        parcel.writeString(phone)
        parcel.writeValue(provinceId)
        parcel.writeValue(status)
        parcel.writeString(userId)
    }

    override fun describeContents(): Int {
        return 0
    }

    companion object CREATOR : Parcelable.Creator<AddressListRes> {
        override fun createFromParcel(parcel: Parcel): AddressListRes {
            return AddressListRes(parcel)
        }

        override fun newArray(size: Int): Array<AddressListRes?> {
            return arrayOfNulls(size)
        }
    }
}